package com.board.servlet.helper;

import com.board.action.Action;
import com.board.action.SimpleAction;
import com.board.action.admin.AdminDeleteBoardAction;
import com.board.action.admin.AuthUpdateAction;
import com.board.action.admin.UserListAction;
import com.board.action.board.BoardListAction;
import com.board.action.board.DeleteBoardAction;
import com.board.action.board.DetailBoardAction;
import com.board.action.board.ReplyBoardAction;
import com.board.action.board.UpdateBoardAction;
import com.board.action.board.WriteBoardAction;

public class BoardActionFactory implements ActionFactory{
	private static BoardActionFactory factory;
	
	public static BoardActionFactory getInstance(){
		if(factory==null){
			factory=new BoardActionFactory();
		}
		return factory;
	}
	
	public Action getAction(String command){
		Action action=null;
		if(command.equalsIgnoreCase("list")){
			action=new BoardListAction();//loginafter
		}else if(command.equalsIgnoreCase("calendar")){
			action=new SimpleAction();
		}else if(command.equalsIgnoreCase("writeform")){
			action=new SimpleAction();
		}else if(command.equalsIgnoreCase("detail")){
			action=new DetailBoardAction();
		}else if(command.equalsIgnoreCase("write")){
			action=new WriteBoardAction();
		}else if(command.equalsIgnoreCase("bfupdate")){
			action=new UpdateBoardAction();
		}else if(command.equalsIgnoreCase("update")){
			action=new UpdateBoardAction();
		}else if(command.equalsIgnoreCase("bfreply")){
			action=new ReplyBoardAction();
		}else if(command.equalsIgnoreCase("reply")){
			action=new ReplyBoardAction();
		}else if(command.equalsIgnoreCase("delete")){
			action=new DeleteBoardAction();
		}else if(command.equalsIgnoreCase("adminlist")){
			action=new UserListAction();
		}else if(command.equalsIgnoreCase("adminauth")){
			action=new AuthUpdateAction();
		}else if(command.equalsIgnoreCase("authupdate")){
			action=new AuthUpdateAction();
		}else if(command.equalsIgnoreCase("admindeletelist")){
			action=new AdminDeleteBoardAction();
		}else if(command.equalsIgnoreCase("realdel")){
			action=new AdminDeleteBoardAction();
		}
		return action;
	}
}
